package com.yxc.translationdemo.const_enum;

/**
 * 编码类型
 *
 * @author: YXC
 * @time: 2022/12/2 10:23
 **/
public enum SystemCodeTypeEnum {

    /**
     * 攻击类型
     */
    ATTACK_TYPE("attack_type"),
    /**
     * 攻击阶段
     */
    ATTACK_PHASE("attack_phase"),
    /**
     * 告警严重程度
     */
    SEVERITY_OF_ALARM("severity_of_alarm"),
    /**
     * 告警类型厂商
     */
    ALARM_ENGINE_MANUFACTURER("alarm_engine_manufacturer"),
    /**
     * 置信度
     */
    EVENT_CONFIDENCE("event_confidence"),
    /**
     * 攻击结果
     */
    ATTACK_RESULT("attack_result"),
    /**
     * 失陷状态
     */
    COMPROMISE_STATE("compromise_state"),
    /**
     * 事件状态
     */
    EVENT_STATUS("event_status");

    private String type;

    public String getType() {
        return type;
    }

    SystemCodeTypeEnum(String type) {
        this.type = type;
    }

    public static boolean have(String type) {
        if (type == null || type.equals("")) {
            return false;
        }
        for (SystemCodeTypeEnum systemCodeType : SystemCodeTypeEnum.values()) {
            if (systemCodeType.getType().equals(type)) {
                return true;
            }
        }
        return false;
    }

    public static SystemCodeTypeEnum getByType(String type) {
        if (type == null || type.equals("")) {
            return null;
        }
        for (SystemCodeTypeEnum systemCodeType : SystemCodeTypeEnum.values()) {
            if (systemCodeType.getType().equals(type)) {
                return systemCodeType;
            }
        }
        return null;
    }
}
